package com;


import com.opensymphony.xwork2.ActionSupport;

public class UserAction extends ActionSupport {
	String Account;
	private LoginBean loginUser;
	
	public String getAccount() {
		return Account;
	}
	public void setAccount(String account) {
		System.out.println("setAccount() is called!");
		Account = account;
	}
	
//	public LoginBean getLoginUser(){
//		return this.loginUser;
//	}
	
	public void setLoginUser(LoginBean loginUser) {
		System.out.println("setLoginUser() is called!");
		System.out.println(loginUser.getAccount());
		this.loginUser = loginUser;
	}
	
	public String login() {
		System.out.println("login() is called!");
		return this.SUCCESS;
	}
	public void validate() {
		System.out.println("validate() is called!");
		//System.out.println(Account);
String account = loginUser.getAccount();
System.out.println(account);
		String pwd = loginUser.getPassword();
		if (account == null || account.equals("")) {
			this.addFieldError("loginUser.account", "请输入您的用户名！");
		}
		if (pwd == null || pwd.equals("")) {
			this.addFieldError("loginUser.password", "请输入您的密码！");
		}
	}
}
